package org.example.gc;

import java.util.ArrayList;
import java.util.List;

/**
 * -Xms8m -Xmx8m -XX:+HeapDumpOnOutOfMemoryError
 * @author youshang
 * @date 2022/03/30 10:22
 **/
public class HeapOOM {

    byte[] momery = new byte[1 *1024*1024];

    public static void main(String[] args) {
        List<HeapOOM> list = new ArrayList<>();
        int count = 0;
        try {
            while (true){
                list.add(new HeapOOM());
                count++;
            }
        }catch (Exception e){
            System.out.println("count = "+ count);
            e.printStackTrace();
        }
    }
}
